﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AngleExpress.software
{
    abstract class ISoftware
    {
        public abstract void OpenSoftware(string username, string password, string otherParam);
        public virtual bool needLogin()
        {
            return true;
        }

        protected bool IsProcExist(string name)
        {
            Process[] processes = Process.GetProcesses();
            foreach (Process pr in processes)
            {
                Console.WriteLine(pr.ProcessName);
                if (pr.ProcessName == name)
                {
                    return true;
                }
            }
            return false;
        }

        protected void KillProc(string name)
        {
            Process[] processes = Process.GetProcesses();
            foreach (Process pr in processes)
            {
                if (pr.ProcessName == name)
                {
                    try { pr.Kill(); }
                    catch { }
                }
            }
        }
    }
}
